package com.shi.springboot.comment.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.*;

/**
 * <p>
 * 
 * </p>
 *
 * @author stone
 * @since 2021-07-08
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="SysUser对象", description="")
public class SysUser implements Serializable {

    private final String pattern ="^\\w+$";
    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @Max(20)
    @NotNull
    @Pattern(regexp = pattern,message = "必须为中文，数字，英文，或者下划线")
    private String name;

    @Email
    @NotNull
    private String email;

    @Pattern(regexp = pattern,message = "必须为中文，数字，英文，或者下划线")
    @Max(20)
    @NotNull
    private String loginName;

    @Max(20)
    @Min(6)
    @NotNull
    private String password;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    private String createBy;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    private String updateBy;

    @Min(8)
    @Max(8)
    private String salt;
    /**
     * 1、admin，0、person
     */
    private int isAdmin;

}
